package com.test.springboot.springBootUtils.advice;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import com.test.springboot.springBootUtils.bean.ResultCode;
import com.test.springboot.springBootUtils.bean.ResultVo;
import com.test.springboot.springBootUtils.exception.APIException;

/**
 * 对自定义异常的处理
 * @author huyong
 *
 */
@RestControllerAdvice
public class APIExceptionHandler {
	@ExceptionHandler(APIException.class)
	public ResultVo<String> apiExceptionHandler(APIException e) {
		return new ResultVo<String>(ResultCode.FAILED, e.getMsg());

	}

}
